﻿using System;

/* 写一个Circle类，包含「半径」属性、求周长和求面积的成员函数，半径使用构造函数设置（可参考7）*/
namespace Practice10
{
    public class Circle
    {
        const double PI = Math.PI;

        private double radius;

        public Circle()
        { }

        public Circle(double ra)
        {
            radius = ra;
        }

        public double GetCircumference()
        {
            return Math.Round(2 * PI * radius, 2);
        }

        public double GetArea()
        {
            return Math.Round(Math.Pow(radius, 2) * PI, 2);
        }

        public static void Execute()
        {
            Circle c = new(2);
            Console.WriteLine("周长: " + c.GetCircumference());
            Console.WriteLine("面积: " + c.GetArea());
        }
    }
}